package com.example.ssm.c;

import com.example.ssm.c.Business;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {
    public static void main(String[] args) {
//        Business business = new Business();
////        business.setDeviceWriter(new FloppyWriter());
//        business.setDeviceWriter(new UsbWriter());
//        business.saveData();

        // 加载 Spring 容器
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        // 从容器中取出一个类的实例
        Business business = (Business) applicationContext.getBean("business");
        business.saveData();
    }
}
